<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>FastDFS文件服务器</title>
<!--    <link rel="stylesheet" href="../static/css/login.css">-->
<!--    <link rel="stylesheet" type="text/css" th:href="@{static/css/font-awesome.css}">-->
    <link rel="stylesheet" href="../static/dist/css/bootstrap.css">
    <link rel="stylesheet" href="../static/dist/css/bootstrap.min.css">
    <link rel="stylesheet" th:href="@{../static/dist/js/bootstrap.min.js}">
</head>
<body>
<div class="jumbotron">
    <h1>文件管理</h1>
    <p>文件大小在10M以下,文件越大,速度越慢,请谅解...</p>
<!--    <p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a></p>-->
</div>
<!--<form th:action="@{/fastdfs/upload}" enctype="multipart/form-data" method="post" class="form-inline">-->
<!--    <input type="file" name="file" multiple="multiple">-->
<!--    <input type="submit" value="上传">-->
<!--</form>-->

<form class="navbar-form navbar-left" role="search" th:action="@{/fastdfs/upload}" enctype="multipart/form-data" method="post">
    <div class="form-group">
        <input type="file" class="form-control"  name="file" >
    </div>
    <button type="submit" class="btn btn-default">Upload</button>
</form>
<form class="navbar-form navbar-left" role="search" th:action="@{/fastdfs/searchAndPage}" method="get">
    <div class="form-group">
        <input type="text" class="form-control" placeholder="文件名" name="searchname" th:value="${searchname}">
    </div>
    <button type="submit" class="btn btn-default">Search</button>
    <a th:href="@{/fastdfs/searchAndPage}"><button type="button" class="btn btn-default">Clear</button></a>
</form>
<br><br>
<table class="table">
    <tr>
        <td>ID</td>
        <td>文件名</td>
        <td>URL</td>
        <td>操作</td>
    </tr>
    <tr th:each="fastdfsfile : ${fastdfsfiles}">
        <td th:text="${fastdfsfile.id}"> </td>
        <td th:text="${fastdfsfile.name}"> </td>
        <td th:text="${fastdfsfile.url}"> </td>
        <td><a th:href="@{/fastdfs/look(furl=${fastdfsfile.url})}"><span class="glyphicon glyphicon-share-alt" aria-hidden="true"></span></a> &nbsp;
            <a th:href="@{/fastdfs/download(fid=${fastdfsfile.url})}"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span></a>&nbsp;
            <a th:href="@{/fastdfs/delete(fid=${fastdfsfile.id},furl=${fastdfsfile.url})}"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a></td>
    </tr>
</table>
<nav aria-label="Page navigation" class="text-center">
    <ul class="pagination pagination-lg">
        <li  aria-label="Previous">
            <a th:href="'/fastdfs/searchAndPage?searchname='+${searchname}+'&pageNum=' + ${pageNo -1}"  th:class="${pageNo}-1 le 0 ? 'btn btn-default btn-lg disabled':'' ">
                <span class="glyphicon glyphicon-chevron-left"></span>
            </a>
        </li>
        <li th:each=" pageNum:${#numbers.sequence(1,totalPages)}" >
            <a th:href="'/fastdfs/searchAndPage?searchname='+${searchname}+'&pageNum=' + ${pageNum}" th:text="${pageNum}" th:if="${pageNum} ne ${pageNo}"></a>
            <a th:href="'/fastdfs/searchAndPage?searchname='+${searchname}+'&pageNum=' + ${pageNum}" th:text="${pageNum}" th:if="${pageNum} eq ${pageNo}" th:style="'font-weight:bold;background: #84C1FF;'"></a>
        </li>
        <li aria-label="Next" >
            <a th:href="@{/fastdfs/searchAndPage(searchname=${searchname},pageNum=${pageNo} + 1)}"  th:class="${pageNo}+1 gt ${totalPages} ? 'btn btn-default btn-lg disabled':'' ">
                <span class="glyphicon glyphicon-chevron-right"></span>
            </a>
        </li>
    </ul>
</nav>
<p th:text="当前页 + ${pageNo}"><p th:text="总页数 + ${totalPages}"><p th:text="总条数 + ${totalElements}">
</body>
</html>
